package com.team.employment.web.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.team.employment.model.entity.BenefitInfo;
import com.team.employment.web.admin.service.BenefitInfoService;
import com.team.employment.web.admin.mapper.BenefitInfoMapper;
import com.team.employment.web.admin.vo.BenefitDetailVo;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class BenefitInfoServiceImpl extends ServiceImpl<BenefitInfoMapper, BenefitInfo>
    implements BenefitInfoService{


    @Autowired
    private BenefitInfoMapper benefitInfoMapper;

    @Override
    public BenefitDetailVo getCompanyBenefit(Long id) {
        LambdaQueryWrapper<BenefitInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(BenefitInfo::getId,id);
        BenefitInfo benefitInfo = benefitInfoMapper.selectOne(lambdaQueryWrapper);
        BenefitDetailVo benefitDetailVo = BenefitDetailVo.builder().benefitId(benefitInfo.getId())
                .benefitDescription(benefitInfo.getContext())
                .benefitName(benefitInfo.getName())
                .build();

        return benefitDetailVo;
    }
}




